#include<iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#define N 50
int main() {
    int n = 0, a[N], i, m, b[N], j = 0;
    cin >> n;
    for (i = 0; i < n; i++) {
        cin >> a[i];
    }
    cin >> m;
    for (i = 0; i < n; i++) {
        if (a[i] != m) {
            b[j] = a[i];
            j++;
        }
    }
    for (i = 0; i < j ; i++) {
        cout << b[i] << " ";
    }
    cout << endl;
    return 0;
}
